package com.ww.springboot.boot.javabase.list;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * 描述：
 *
 * @author 🧑 ‍wanwei
 * @since 2022-01-20 16:27
 */
public class CopyDemo {
    public static void main(String[] args) {
        List<Integer> ss = IntStream.range(0, 100000000).boxed().collect(Collectors.toList());

        System.out.println("-----------------");
        new Thread(() -> {
            Long t = System.currentTimeMillis();
            List<Integer> sss = ss.stream().collect(Collectors.toList());
            System.out.println("2" + (t - System.currentTimeMillis()));//2-25083
        }).start();
        new Thread(() -> {
            Long t = System.currentTimeMillis();
            List<Integer> sss = new ArrayList<>(ss);
            System.out.println("1" + (t - System.currentTimeMillis()));//1-2421
        }).start();

    }
}
